﻿@namespace Xms.Abp.Components

<div class="ant-condition">
<AntList Bordered DataSource="Value.Group">
    <Header>
        选择组关系：
        <EnumSelect Size="small" TEnum="ConditinRelation" @bind-Value="Value.Relation" Style="width:80px;" Disabled="ReadOnly"></EnumSelect>
        @if (Value.Group.Count <= 0 && !ReadOnly)
        {
            <Popconfirm
                Title="@("请选择添加内容")"
                OnConfirm='_ => OnAdd(0)'
                OnCancel='_ => OnAddGroup(0)'
                OkText="条件"
                CancelText="条件组"
                Style="float:right;"
            >
                <Button Icon="plus-circle" Size="small"></Button>
            </Popconfirm>
        }
    </Header>
    <ChildContent Context="context">
        <li class="ant-list-item">
            @*<div>@context.Index</div>*@
            <ConditionSection Fields="ConditionFields" @bind-Value="context" ReadOnly="ReadOnly"></ConditionSection>
            @if (!ReadOnly)
            {
            <div style="width:65px!important;padding-left:4px;">
                @{
                    int index = context.Index;
                }
                <Popconfirm
                    Title="@("请选择添加内容")"
                    OnConfirm='_ => OnAdd(index)'
                    OnCancel='_ => OnAddGroup(index)'
                    OkText="条件"
                    CancelText="条件组"
                >
                    <Button Icon="plus-circle" Size="small"></Button>
                </Popconfirm>
                <Popconfirm
                    Title="@("确定要移除本条件吗？")"
                    OnConfirm='_ => OnSub(context)'
                    OkText="确定"
                    CancelText="取消"
                >
                    <Button Icon="minus-circle" Size="small"></Button>
                </Popconfirm>
            </div>  
            }
        </li>
    </ChildContent>
</AntList>
<style>
    .ant-condition .ant-list-bordered .ant-list-header,.ant-condition .ant-list-bordered .ant-list-item{
        padding: 4px!important;
    }
</style>
</div>
